//
//  DSUnitCell.m
//  DSJY
//
//  Created by 冯华强 on 16/9/23.
//  Copyright © 2016年 dsjy. All rights reserved.
//  单元列表Cell

#import "DSUnitCell.h"
#import "DSCourse.h"
#import "DSUnit.h"
#import "UIImageView+WebCache.h"

@interface DSUnitCell ()
//图片
@property (weak, nonatomic) IBOutlet UIImageView *iconView;
//标题
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
//锁的标志
@property (weak, nonatomic) IBOutlet UIImageView *lockedView;
@end

@implementation DSUnitCell

#pragma mark - 设置UI
- (void)setUnit:(DSUnit *)unit
{
    _unit = unit;
    
    [self setupName:unit.name iconUrlString:unit.unitimageString iscloseb:unit.iscloseb];
}

- (void)setupName:(NSString *)name iconUrlString:(NSString *)iconUrlString iscloseb:(BOOL)iscloseb
{
    self.lockedView.hidden = !iscloseb;
    self.titleLabel.text = name;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:iconUrlString] placeholderImage:[UIImage imageNamed:@"defaultH310"]];
}

@end
